package muse.widgets;

import java.awt.*;
import java.util.Random;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import muse.Launcher;

public class TextboxWidget extends Widget {
	private JLabel text;
        Toolkit tk = Toolkit.getDefaultToolkit();
        Image textboxImg = tk.getImage(getClass().getClassLoader().getResource("muse/resources/muse_textBox_dummy.png"));
        
        JTextArea textArea;
	public TextboxWidget()
        {
            this.setLayout(new BorderLayout());
            
            textArea = new JTextArea();
            textArea.setEditable(false);
            textArea.setBackground(null);
            textArea.setOpaque(false);
            textArea.setLineWrap(true);
            textArea.setWrapStyleWord(true);
            textArea.setVisible(true);
            textArea.setSize(280, 90);
            textArea.setLocation(30, 20);
            textArea.setText("I believe I can impress you in a hundred different ways! Are you impressed yet?");
            Random rng = new Random();
            textArea.setText(Launcher.greetings[rng.nextInt(4)]);
            JPanel all = new JPanel(){
                public void paintComponent(Graphics g)
                {
                    
                    g.drawImage(textboxImg, 0, 0, getWidth(), getHeight(), null);
                    
                }
            };
            all.add(textArea);
            this.add(all);
        }

	public TextboxWidget(String s) {
		super();
		text = new JLabel();
		text.setText(s);
	}

	@Override
	public Dimension getPreferredSize() {
		return new Dimension(288,96);
	}

	@Override
	public String getIcon() {
		return "";
	}

}
